package com.sdleyou.treepro.common.listener;

import com.sdleyou.treepro.common.model.dao.UserPetDO;
import com.sdleyou.treepro.common.service.PetManager;
import com.sdleyou.treepro.common.service.UserPetManager;
import com.sdleyou.treepro.common.utils.RedisDelayedQueue;
import org.springframework.beans.factory.annotation.Autowired;

public class PetHuntListener extends RedisDelayedQueue.TaskEventListener<UserPetDO> {

    @Autowired
    private UserPetManager petManager;

    @Override
    public void invoke(UserPetDO userPetDO) {
        //这里调用你延迟之后的代码
        //System.out.println("返回");
        if(userPetDO !=null && userPetDO.getPetStatus()==1){
            petManager.finishHunt(userPetDO);
        }
    }
}